import React,{useState,useEffect} from "react"
import {instance} from './utils/request'
import { Tabs } from 'antd-mobile'
import axios from "axios"
const App=()=>{
  //设置状态
  const [list,SetList]=useState([])
  const getList=async()=>{
    const res=await axios.get('/api/list')
    SetList(res.data.data.data)
    console.log(res);
    
  }
  useEffect(()=>{
    getList()
  },[])
  return <div>
     <Tabs>
          <Tabs.Tab title='机票' key='机票'>
          机票
          </Tabs.Tab>
          <Tabs.Tab title='汽车票' key='汽车票'>
          汽车票
          </Tabs.Tab>
          <Tabs.Tab title='高铁票' key='高铁票'>
          {
            list.length>0&&list.map((item,ind)=>{
              return <div key={ind}>
                <p>{item.id}</p>
                <p>{item.shopName}</p>
                <img src={item.shopImage} alt="" />
                <p>{item.shopDescription}</p>

              </div>
            })
          }
          </Tabs.Tab>
        </Tabs>
  </div>
}
export default App